using System;
using System.IO;

namespace SolutionFactory.Services
{
    public class DynamicFileVisitor : MatchingFileVisitor
    {
        private readonly Action<FileInfo> _fileAction;

        public DynamicFileVisitor(string fileExtension, Action<FileInfo> fileAction) : base(fileExtension)
        {
            _fileAction = fileAction;
        }

        protected override void VisitMatchingFile(FileInfo file)
        {
            _fileAction(file);
        }
    }
}